.class Lcom/xingbook/park/activity/an;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic a:Lcom/xingbook/park/activity/am;

.field private final synthetic b:Ljava/lang/String;

.field private final synthetic c:Lcom/xingbook/park/activity/LoginAct;


# direct methods
.method constructor <init>(Lcom/xingbook/park/activity/am;Ljava/lang/String;Lcom/xingbook/park/activity/LoginAct;)V
    .locals 0

    iput-object p1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    iput-object p2, p0, Lcom/xingbook/park/activity/an;->b:Ljava/lang/String;

    iput-object p3, p0, Lcom/xingbook/park/activity/an;->c:Lcom/xingbook/park/activity/LoginAct;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 5

    const/4 v0, 0x0

    :try_start_0
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "https://api.weixin.qq.com/sns/oauth2/access_token?appid="

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, "wx7b44c2f05cfcf1be"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "&secret="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "05a9fb46bc8a3aa2c391b1213b71a3dc"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "&code="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/xingbook/park/activity/an;->b:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "&grant_type=authorization_code"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    new-instance v2, Ljava/net/URL;

    invoke-direct {v2, v1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Ljava/net/URL;->openStream()Ljava/io/InputStream;

    move-result-object v1

    new-instance v2, Ljava/io/BufferedReader;

    new-instance v3, Ljava/io/InputStreamReader;

    invoke-direct {v3, v1}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v2, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    const-string v1, ""

    const-string v1, ""

    :goto_0
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_4

    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string v1, "openid"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_7

    const-string v1, "access_token"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_7

    const-string v1, "openid"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v3, "access_token"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    if-eqz v1, :cond_7

    const-string v3, ""

    invoke-virtual {v3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_7

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "https://api.weixin.qq.com/sns/userinfo?access_token="

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "&openid="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    new-instance v2, Ljava/net/URL;

    invoke-direct {v2, v1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Ljava/net/URL;->openStream()Ljava/io/InputStream;

    move-result-object v1

    new-instance v2, Ljava/io/BufferedReader;

    new-instance v3, Ljava/io/InputStreamReader;

    invoke-direct {v3, v1}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v2, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    const-string v1, ""

    const-string v3, ""

    :goto_1
    invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_5

    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2, v1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string v1, "headimgurl"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_6

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const-string v3, "headimgurl"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;Ljava/lang/String;)V

    :goto_2
    const-string v1, "nickname"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_8

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const-string v3, "nickname"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->b(Lcom/xingbook/park/activity/am;Ljava/lang/String;)V

    :goto_3
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const/4 v3, 0x0

    iget-object v4, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v4}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->length()I

    move-result v4

    invoke-virtual {v1, v3, v4}, Ljava/lang/StringBuilder;->delete(II)Ljava/lang/StringBuilder;

    const-string v1, "country"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "country"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    :cond_0
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "/"

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "province"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "province"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    :cond_1
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "/"

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "city"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    invoke-static {v1}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, "city"

    invoke-virtual {v2, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    :cond_2
    const-string v1, "sex"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_b

    const-string v1, "sex"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v3, "\u7537"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_9

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x1

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;I)V

    :goto_4
    const-string v1, "unionid"

    invoke-virtual {v2, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_3

    const-string v0, "unionid"

    invoke-virtual {v2, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :cond_3
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/16 v2, 0x3ea

    invoke-virtual {v1, v2, v0}, Lcom/xingbook/park/activity/am;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    :goto_5
    return-void

    :cond_4
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v4, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto/16 :goto_0

    :cond_5
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v4, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    goto/16 :goto_1

    :cond_6
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_1

    goto/16 :goto_2

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    :cond_7
    :goto_6
    iget-object v0, p0, Lcom/xingbook/park/activity/an;->c:Lcom/xingbook/park/activity/LoginAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/LoginAct;->e(Lcom/xingbook/park/activity/LoginAct;)V

    iget-object v0, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/16 v1, 0x3e9

    const-string v2, "\u5fae\u4fe1\u6388\u6743\u5931\u8d25\uff01"

    invoke-virtual {v0, v1, v2}, Lcom/xingbook/park/activity/am;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    goto :goto_5

    :cond_8
    :try_start_1
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->b(Lcom/xingbook/park/activity/am;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_1

    goto/16 :goto_3

    :catch_1
    move-exception v0

    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_6

    :cond_9
    :try_start_2
    const-string v3, "\u5973"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_a

    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x2

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;I)V

    goto :goto_4

    :cond_a
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;I)V

    goto/16 :goto_4

    :cond_b
    iget-object v1, p0, Lcom/xingbook/park/activity/an;->a:Lcom/xingbook/park/activity/am;

    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/xingbook/park/activity/am;->a(Lcom/xingbook/park/activity/am;I)V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
    .catch Lorg/json/JSONException; {:try_start_2 .. :try_end_2} :catch_1

    goto/16 :goto_4
.end method
